/*
 * @ author madman 
 * @ use 产品schema
 */
var mongoose = require("mongoose");
var Schema = mongoose.Schema;
var shortid = require('shortid');
var goodsSchema = new Schema({
    // 商品ID
     _id: {
        type: String,
        'default': shortid.generate
    },
    // 商品名称
    name: {
        type: String,
        required: true
    },
    // 商品缩略图
    thumbnail: {
        type: String,
    },
    // 商品缩组图ID
    thumbId: {
        type: String,
        ref: 'j_upload'
    },
    // 新建时间
    createdAt: {
        type: Date,
        default: Date.now
    },
    // 更新时间
    updataAt: {
        type: Date
    }
});
module.exports = mongoose.model('j_goods', goodsSchema, 'j_goods');